#include <iostream>
#include <string.h>
#include <stdio.h>
using namespace std;

class a
{
private:
    char text[128];

protected:
    int n;

public:
    a(const char *data)
    {
        strcpy(text, data);
    }
    void print()
    {
        cout << text << endl;
    }
};

void openfile()
{
    FILE *fp = fopen("1.txt", "r+");
    if (fp == NULL)
    {
        throw a("打开文件不存在");
    }
    cout << "打开成功" << endl;
}

int main(int argc, char const *argv[])
{
    try
    {
        openfile();
    }
    catch (a a1)
    {
        a1.print();
    }
    return 0;
}
